package com.wcs.exam.controller.admin;

import com.wcs.exam.common.base.Result;
import com.wcs.exam.common.base.annotation.OptLog;
import com.wcs.exam.common.base.page.Page;
import com.wcs.exam.controller.admin.biz.AdminUsersLogBiz;
import com.wcs.exam.controller.admin.req.AdminUsersLogPageReq;
import com.wcs.exam.controller.admin.resp.AdminUsersLogPageResp;
import com.wcs.exam.controller.admin.resp.AdminUsersLogViewResp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * Admin-用户注册登录日志
 *
 * @author wcs
 * @since 2024-07-06
 */
@Tag(name = "Admin-用户注册登录日志")
@RestController
@RequiredArgsConstructor
@RequestMapping("/user/admin/users/log")
public class AdminUsersLogController {

    @NotNull
    private final AdminUsersLogBiz biz;

    @Operation(summary = "用户注册登录日志-分页")
    @GetMapping(value = "/page")
    public Result<Page<AdminUsersLogPageResp>> page(@ModelAttribute AdminUsersLogPageReq req) {
        return biz.page(req);
    }

    @Operation(summary = "用户注册登录日志-查看")
    @Parameter(name = "id", description = "主键ID", required = true)
    @GetMapping(value = "/view")
    public Result<AdminUsersLogViewResp> view(@RequestParam Long id) {
        return biz.view(id);
    }

    @Operation(summary = "用户注册登录日志-删除")
    @Parameter(name = "id", description = "主键ID", required = true)
    @OptLog(value = "用户注册登录日志删除")
    @DeleteMapping(value = "/delete")
    public Result<String> delete(@RequestParam Long id) {
        return biz.delete(id);
    }
}
